function CBXYandexPoint(e){this.DATA={LON:0,LAT:0,TEXT:""};this.PLACEMARK=null;this.VIEW=null;this.EDIT_CONTROL=null;this.onCreate=null;this.onDelete=null;if(null!=e){this.Create(e)}}CBXYandexPoint.prototype.__updatePointPosition=function(e){var t=this.PLACEMARK.geometry.getCoordinates();this.DATA.LAT=t[0];this.DATA.LON=t[1]};CBXYandexPoint.prototype.Delete=function(e){if(null!=this.VIEW&&null!=this.VIEW.parentNode)this.VIEW.parentNode.removeChild(this.VIEW);jsYandexCE.map.geoObjects.remove(this.PLACEMARK);this.PLACEMARK=null;if(null!=this.onDelete)this.onDelete(this);return BX.PreventDefault(e)};CBXYandexPoint.prototype.Edit=function(e){e=e||window.event;var t=this;jsYandexCE.map.panTo(this.PLACEMARK.geometry.getCoordinates(),{delay:0,flying:false,callback:function(){if(t.PLACEMARK._balloonVisible)t.PLACEMARK.balloon.close();else{t.PLACEMARK.balloon.open();t.EDIT_CONTROL.focus()}}});if(null!=e)return BX.PreventDefault(e)};CBXYandexPoint.prototype.__updateView=function(e){e=e||window.event;value=BX.proxy_context.value;this.DATA.TEXT=value;var t=value.indexOf("\n");var a="";if(value.length>0)a=t<=0?value:value.substring(0,t);a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");this.__updateViewText(a?a:window.jsYandexMess.noname);return BX.PreventDefault(e)};CBXYandexPoint.prototype.__point_link_hover=function(){this.style.backgroundColor="#E3E8F7";this.firstChild.style.display="block"};CBXYandexPoint.prototype.__point_link_hout=function(){this.style.backgroundColor="transparent";this.firstChild.style.display="none"};CBXYandexPoint.prototype.__updateViewText=function(e){this.VIEW.firstChild.nextSibling.innerHTML=e};CBXYandexPoint.prototype.getData=function(){return this.DATA};CBXYandexPoint.prototype.Create=function(e){this.DATA.TEXT=e.TEXT;this.DATA.LAT=e.LAT;this.DATA.LON=e.LON;this.__createView();var t="";if(this.DATA.TEXT.length>0){var a=this.DATA.TEXT.indexOf("\n");t=a<=0?this.DATA.TEXT:this.DATA.TEXT.substring(0,a);t=t.replace(/>/g,"&gt;");t=t.replace(/</g,"&lt;")}this.__updateViewText(t?t:window.jsYandexMess.noname);this.PLACEMARK=new window.ymaps.Placemark([this.DATA.LAT,this.DATA.LON],{balloonContent:this.__createEditForm()},{draggable:true});this.PLACEMARK.events.add("dragend",BX.proxy(this.__updatePointPosition,this));jsYandexCE.map.geoObjects.add(this.PLACEMARK);if(null!==this.onCreate)this.onCreate(this);return this.PLACEMARK};CBXYandexPoint.prototype.__createEditForm=function(){this.EDIT_CONTROL=document.createElement("TEXTAREA");this.EDIT_CONTROL.value=this.DATA.TEXT;this.EDIT_CONTROL.style.resize="none";this.EDIT_CONTROL.rows="4";this.EDIT_CONTROL.onkeyup=this.EDIT_CONTROL.onblur=BX.proxy(this.__updateView,this);return this.EDIT_CONTROL};CBXYandexPoint.prototype.__createView=function(){this.VIEW=BX("bx_yandex_points").appendChild(document.createElement("LI"));var e=this.VIEW.appendChild(document.createElement("A"));e.href="javascript: void(0)";e.className="bx-yandex-delete";e.onclick=BX.delegate(this.Delete,this);e.style.display="none";var t=this.VIEW.appendChild(document.createElement("A"));t.className="bx-yandex-point";t.href="javascript:void(0)";t.onclick=BX.delegate(this.Edit,this);t.innerHTML=window.jsYandexMess.noname;this.VIEW.onmouseover=this.__point_link_hover;this.VIEW.onmouseout=this.__point_link_hout};function CBXYandexPoly(e){this.DATA={POINTS:[],TITLE:"",STYLE:{}};this.POLYLINE=null;this.VIEW=null;this.EDIT_CONTROL=null;this.STYLE=null;this.START_POINT=null;this.END_POINT=null;this.bFinished=false;this.onFinish=null;this.onDelete=null;if(null!=e){this.Create(e)}}CBXYandexPoly.prototype.Finish=function(e){if(!jsYandexCE.bAddPolyMode)return;this.bFinished=true;jsYandexCE.map.events.remove("click",BX.proxy(this.__addPoint,this));jsYandexCE.map.geoObjects.remove(this.START_POINT);if(null==this.POLYLINE){this.Delete()}else{this.END_POINT.properties.set("hintContent",jsYandexMess.poly_settings);this.END_POINT.events.remove("click",BX.delegate(this.Finish,this));this.END_POINT.events.add("click",BX.delegate(this.showSettingsForm,this))}if(null!=this.onFinish){this.onFinish(this)}};CBXYandexPoly.prototype.__addPoint=function(e){if(!jsYandexCE.bAddPolyMode)return;if(null==this.END_POINT){this.END_POINT=new ymaps.Placemark(e.get("coordPosition"),{hintContent:jsYandexMess.poly_finish});this.END_POINT.events.add("click",BX.delegate(this.Finish,this));jsYandexCE.map.geoObjects.add(this.END_POINT)}else{this.END_POINT.geometry.setCoordinates(e.get("coordPosition"))}if(this.DATA.POINTS.length<=0){this.DATA.POINTS=[this.START_POINT.geometry.getCoordinates(),e.get("coordPosition")]}if(null!==this.POLYLINE){this.DATA.POINTS.push(e.get("coordPosition"));this.POLYLINE.geometry.setCoordinates(this.DATA.POINTS);this.__updateViewText(jsYandexMess.noname)}else{this.setStyle();this.prepareSettingsForm();this.POLYLINE=new ymaps.Polyline(this.DATA.POINTS,{},{clickable:false,strokeColor:this.STYLE.strokeColor,strokeWidth:this.STYLE.strokeWidth});jsYandexCE.map.geoObjects.add(this.POLYLINE);this.__createView()}};CBXYandexPoly.prototype.Start=function(e){this.START_POINT=new ymaps.Placemark(e,{hintContent:jsYandexMess.poly_start_point});jsYandexCE.map.geoObjects.add(this.START_POINT);jsYandexCE.map.events.add("click",BX.proxy(this.__addPoint,this))};CBXYandexPoly.prototype.showSettingsForm=function(e){if(!this.bFinished)this.Finish();if(this.END_POINT.balloon.isOpen()){this.END_POINT.balloon.close()}else{jsYandexCE.map.geoObjects.add(this.END_POINT);this.END_POINT.balloon.open()}return BX.PreventDefault(e)};CBXYandexPoly.prototype.Delete=function(e){if(null!=this.VIEW&&null!=this.VIEW.parentNode)this.VIEW.parentNode.removeChild(this.VIEW);if(null!=this.POLYLINE)jsYandexCE.map.geoObjects.remove(this.POLYLINE);jsYandexCE.map.geoObjects.remove(this.START_POINT);if(null!=this.END_POINT)jsYandexCE.map.geoObjects.remove(this.END_POINT);this.POLYLINE=null;if(!this.bFinished)this.Finish();if(null!=this.onDelete)this.onDelete(this);return BX.PreventDefault(e)};CBXYandexPoly.prototype.__poly_link_hover=function(){this.style.backgroundColor="#E3E8F7";this.firstChild.style.display="block"};CBXYandexPoly.prototype.__poly_link_hout=function(){this.style.backgroundColor="#FFFFFF";this.firstChild.style.display="none"};CBXYandexPoly.prototype.__updateViewText=function(e){this.VIEW.firstChild.nextSibling.innerHTML=e+" ("+this.DATA.POINTS.length+")"};CBXYandexPoly.prototype.getData=function(){var e={POINTS:[],TITLE:"",STYLE:{}};for(var t=0,a=this.DATA.POINTS.length;t<a;t++){e.POINTS[t]={LAT:this.DATA.POINTS[t][0],LON:this.DATA.POINTS[t][1]}}e.TITLE=this.DATA.TITLE;e.STYLE={strokeColor:this.STYLE.strokeColor,strokeWidth:this.STYLE.strokeWidth};return e};CBXYandexPoly.prototype.Create=function(e){this.DATA.POINTS=[];for(var t=0,a=e.POINTS.length;t<a;t++){this.DATA.POINTS[t]=[e.POINTS[t].LAT,e.POINTS[t].LON]}if(null!=e.STYLE){if(null!=e.STYLE.lineStyle)e.STYLE=e.STYLE.lineStyle;this.DATA.STYLE.strokeWidth=e.STYLE.strokeWidth;this.DATA.STYLE.strokeColor=e.STYLE.strokeColor}this.setStyle();this.DATA.TITLE=e.TITLE;this.START_POINT=new ymaps.Placemark([e.POINTS[0].LAT,e.POINTS[0].LON]);this.END_POINT=new ymaps.Placemark([e.POINTS[e.POINTS.length-1].LAT,e.POINTS[e.POINTS.length-1].LON],{hintContent:this.DATA.TITLE?this.DATA.TITLE:jsYandexMess.poly_settings});jsYandexCE.map.geoObjects.add(this.END_POINT);this.setStyle();this.POLYLINE=new ymaps.Polyline(this.DATA.POINTS,{},{strokeColor:this.DATA.STYLE.strokeColor==null?"FF00007F":this.DATA.STYLE.strokeColor,strokeWidth:this.DATA.STYLE.strokeWidth==null?"3":this.DATA.STYLE.strokeWidth,clickable:true});this.prepareSettingsForm();jsYandexCE.map.geoObjects.add(this.POLYLINE);this.__createView();this.setTitle()};CBXYandexPoly.prototype.__createView=function(){this.VIEW=BX("bx_yandex_polylines").appendChild(document.createElement("LI"));var e=this.VIEW.appendChild(document.createElement("A"));e.href="javascript: void(0)";e.className="bx-yandex-delete";e.onclick=BX.delegate(this.Delete,this);e.style.display="none";var t=this.VIEW.appendChild(document.createElement("A"));t.className="bx-yandex-poly";t.href="javascript:void(0)";t.onclick=BX.delegate(this.showSettingsForm,this);t.innerHTML=window.jsYandexMess.noname+" ("+this.DATA.POINTS.length+")";this.VIEW.onmouseover=this.__poly_link_hover;this.VIEW.onmouseout=this.__poly_link_hout;return this.VIEW};CBXYandexPoly.prototype.prepareSettingsForm=function(){this.EDIT_CONTROL=document.createElement("FORM");this.END_POINT.properties.set("balloonContent",this.EDIT_CONTROL);this.EDIT_CONTROL.BX_POLYLINE=this;var e=document.createElement("DIV");this.EDIT_CONTROL.appendChild(e);this.COLORPICKER=new BXColorPicker({id:"CP_bx_yandex_ce",name:window.jsYandexMess.poly_opt_color,zIndex:BX.WindowManager.Get().zIndex+100,OnSelect:BX.delegate(function(e){if(!e)e="FF0000";else e=e.substring(1);this.EDIT_CONTROL.elements[1].value=e;this.setStyle("color",e,this.EDIT_CONTROL.elements[0])},this)});e.innerHTML="<b>"+window.jsYandexMess.poly_opt_header+"</b>"+'<br /><br /><table class="bx-yandex-poly-settings">'+'<tr><td><span style="font-size: 11px;">'+window.jsYandexMess.poly_opt_title+'</span></td><td><input type="text" value="" style="width: 125px;" onkeyup="this.form.BX_POLYLINE.setTitle(this.value)" /></td></tr>'+'<tr><td><span style="font-size: 11px;">'+window.jsYandexMess.poly_opt_color+'</span></td><td><input type="text" value="'+this.STYLE.strokeColor.substring(0,6)+'" style="width: 100px; float: left;" onkeyup="this.form.BX_POLYLINE.setStyle(\'color\', this.value, this)" /></td></tr>'+'<tr><td><span style="font-size: 11px;">'+window.jsYandexMess.poly_opt_width+'</span></td><td><input type="text" value="'+this.STYLE.strokeWidth+'"  style="width: 125px;"onkeyup="this.form.BX_POLYLINE.setStyle(\'width\', this.value, this)" /></td></tr>'+'<tr><td><span style="font-size: 11px;">'+window.jsYandexMess.poly_opt_opacity+'</span></td><td><input type="text" value="'+Math.round(parseInt("0x"+this.STYLE.strokeColor.substring(6))/2.55)+'" style="width: 125px;"onkeyup="this.form.BX_POLYLINE.setStyle(\'opacity\', this.value, this)" /></td></tr>'+"</table>";if(null!=this.DATA.TITLE)this.EDIT_CONTROL.elements[0].value=this.DATA.TITLE;this.EDIT_CONTROL.elements[1].parentNode.appendChild(this.COLORPICKER.pCont)};CBXYandexPoly.prototype.setTitle=function(e){if(null!=e)this.DATA.TITLE=e;else e=this.DATA.TITLE;this.END_POINT.properties.set("hintContent",e);var t="";if(this.DATA.TITLE.length>0){var a=this.DATA.TITLE.indexOf("\n");t=a<=0?this.DATA.TITLE:this.DATA.TITLE.substring(0,a);t=t.replace(/>/g,"&gt;");t=t.replace(/</g,"&lt;")}this.__updateViewText(t?t:window.jsYandexMess.noname)};CBXYandexPoly.prototype.setStyle=function(e,t,a){if(null==this.STYLE){this.STYLE={strokeColor:this.DATA.STYLE.strokeColor==null?"FF00007F":this.DATA.STYLE.strokeColor,strokeWidth:this.DATA.STYLE.strokeWidth==null?"3":this.DATA.STYLE.strokeWidth}}var n=false;if(null!=e&&null!=t){switch(e){case"color":if(/^[A-F0-9]{6}$/i.test(t)){this.STYLE.strokeColor=t+this.STYLE.strokeColor.substring(6)}else{n=true}break;case"width":t=parseInt(t);if(isNaN(t)){n=true}else{this.STYLE.strokeWidth=t}break;case"opacity":t=parseInt(t);if(!isNaN(t)&&t>=0&&t<=100){t=Math.round(t*2.55).toString(16).toUpperCase();this.STYLE.strokeColor=this.STYLE.strokeColor.substring(0,6)+BX.util.str_pad_left(t,2,"0")}else{n=true}break}if(null!=a){if(n)a.style.backgroundColor="FFB0B0";else a.style.backgroundColor="white"}}if(!n&&null!=this.POLYLINE){this.POLYLINE.options.set("strokeColor",this.STYLE.strokeColor);this.POLYLINE.options.set("strokeWidth",this.STYLE.strokeWidth)}};var jsYandexCE={map:null,arData:{},obForm:null,currentView:"",bPositionFixed:true,bAddPointMode:false,bAddPolyMode:false,onInitCompleted:null,bInitCompleted:false,bInitScriptsLoaded:false,__arValidKeys:["yandex_lat","yandex_lon","yandex_scale","PLACEMARKS","LON","LAT","TEXT","POLYLINES","POINTS","STYLE","lineStyle","strokeColor","strokeWidth","TITLE"],__obMapTypes:{HYBRID:"yandex#hybrid",SATELLITE:"yandex#satellite",PUBLIC:"yandex#publicMap",PUBLIC_HYBRID:"yandex#publicMapHybrid",MAP:"yandex#map"},__currentPolyLine:null,__currentPolyLineObject:null,_getTypeName:function(e){return e=="yandex#hybrid"?"HYBRID":e=="yandex#satellite"?"SATELLITE":e=="yandex#publicMap"?"PUBLIC":e=="yandex#publicMapHybrid"?"PUBLIC_HYBRID":"MAP"},init:function(e){if(null!=e)jsYandexCE.map=e;var t=document.getElementsByTagName("HEAD")[0];BX.loadCSS(["/bitrix/components/bitrix/map.yandex.system/templates/.default/style.css","/bitrix/components/bitrix/map.yandex.view/settings/settings_iframe.css"]);BX.loadScript("/bitrix/components/bitrix/main.colorpicker/templates/.default/script.js",function(){top.jsYandexCE.bInitScriptsLoaded=true;top.jsYandexCE.checkInitCompleted()});jsYandexCE.obForm=document.forms["bx_popup_form_yandex_map"];jsYandexCE.obForm.onsubmit=jsYandexCE.__saveChanges;jsYandexCE.map.events.add("boundschange",jsYandexCE.__getPositionValues);jsYandexCE.map.events.add("sizechange",jsYandexCE.__getPositionValues);jsYandexCE.map.events.add("typechange",jsYandexCE.__getPositionValues);if(!jsYandexCE.arData.yandex_lat||!jsYandexCE.arData.yandex_lon||!jsYandexCE.arData.yandex_scale){var a=jsYandexCE.map.getCenter();jsYandexCE.arData.yandex_lat=a[0];jsYandexCE.arData.yandex_lon=a[1];jsYandexCE.arData.yandex_scale=jsYandexCE.map.getZoom();jsYandexCE.bPositionFixed=false}else{jsYandexCE.bPositionFixed=true}jsYandexCE.currentView=jsYandexMess.current_view;jsYandexCE.setControlValue("yandex_lat",jsYandexCE.arData.yandex_lat);jsYandexCE.setControlValue("yandex_lon",jsYandexCE.arData.yandex_lon);jsYandexCE.setControlValue("yandex_scale",jsYandexCE.arData.yandex_scale);jsYandexCE.setControlValue("yandex_view",jsYandexMess["MAP_VIEW_"+jsYandexCE._getTypeName(jsYandexCE.map.getType())]);BX("bx_restore_position").onclick=jsYandexCE.restorePositionValues;BX("bx_yandex_position_fix").onclick=function(){jsYandexCE.setFixedFlag(this.checked)};jsYandexCE.setFixedFlag(BX("bx_yandex_position_fix").defaultChecked);BX("bx_yandex_map_controls").style.visibility="visible";BX("bx_yandex_map_address_search").style.visibility="visible";jsYandexCE.bInitCompleted=true;jsYandexCE.checkInitCompleted()},checkInitCompleted:function(){if(jsYandexCE.bInitCompleted&&jsYandexCE.bInitScriptsLoaded){if(jsYandexCE.onInitCompleted)jsYandexCE.onInitCompleted();return true}else{return false}},__getPositionValues:function(){if(jsYandexCE.bPositionFixed)return;var e=jsYandexCE.map.getCenter();jsYandexCE.arData.yandex_lat=e[0];jsYandexCE.arData.yandex_lon=e[1];jsYandexCE.arData.yandex_scale=jsYandexCE.map.getZoom();jsYandexCE.setControlValue("yandex_lat",jsYandexCE.arData.yandex_lat);jsYandexCE.setControlValue("yandex_lon",jsYandexCE.arData.yandex_lon);jsYandexCE.setControlValue("yandex_scale",jsYandexCE.arData.yandex_scale);jsYandexCE.currentView=jsYandexCE._getTypeName(jsYandexCE.map.getType());jsYandexCE.setControlValue("yandex_view",jsYandexMess["MAP_VIEW_"+jsYandexCE.currentView])},restorePositionValues:function(e){if(jsYandexCE.currentView&&jsYandexCE.__obMapTypes[jsYandexCE.currentView])jsYandexCE.map.setType(jsYandexCE.__obMapTypes[jsYandexCE.currentView]);jsYandexCE.map.setZoom(+jsYandexCE.arData.yandex_scale);jsYandexCE.map.panTo([+jsYandexCE.arData.yandex_lat,+jsYandexCE.arData.yandex_lon]);return BX.PreventDefault(e)},setFixedFlag:function(e){jsYandexCE.bPositionFixed=e;if(!e)jsYandexCE.__getPositionValues()},setControlValue:function(e,t){var a=jsYandexCE.obForm["bx_"+e];if(null!=a)a.value=t;var n=BX("bx_"+e+"_value");if(null!=n)n.innerHTML=t},addPoint:function(){if(!jsYandexCE.bAddPointMode){if(jsYandexCE.bAddPolyMode)jsYandexCE.addPolyline();jsYandexCE.bAddPointMode=true;jsYandexCE.map.behaviors.disable("dblClickZoom");BX("bx_yandex_addpoint_link").style.display="none";BX("bx_yandex_addpoint_message").style.display="block";jsYandexCE.map.events.add("dblclick",jsYandexCE.__addPoint)}else{jsYandexCE.map.events.remove("dblclick",jsYandexCE.__addPoint);BX("bx_yandex_addpoint_message").style.display="none";BX("bx_yandex_addpoint_link").style.display="block";jsYandexCE.map.behaviors.enable("dblClickZoom");jsYandexCE.bAddPointMode=false}},addPolyline:function(){if(jsYandexCE.bAddPolyMode){if(null!=jsYandexCE.arData.POLYLINES&&jsYandexCE.arData.POLYLINES.length>0&&!jsYandexCE.arData.POLYLINES[jsYandexCE.arData.POLYLINES.length-1].bFinished){if(jsYandexCE.arData.POLYLINES.length>1)jsYandexCE.arData.POLYLINES[jsYandexCE.arData.POLYLINES.length-1].Finish()}jsYandexCE.bAddPolyMode=false;jsYandexCE.map.behaviors.enable("dblClickZoom");BX("bx_yandex_addpoly_link").style.display="block";BX("bx_yandex_addpoly_message").style.display="none";BX("bx_yandex_addpoly_message1").style.display="none";jsYandexCE.map.events.remove("dblclick",jsYandexCE.__startPoly)}else{if(jsYandexCE.bAddPointMode)jsYandexCE.addPoint();jsYandexCE.bAddPolyMode=true;jsYandexCE.map.behaviors.disable("dblClickZoom");BX("bx_yandex_addpoly_link").style.display="none";BX("bx_yandex_addpoly_message").style.display="block";jsYandexCE.map.events.add("dblclick",jsYandexCE.__startPoly)}},addCustomPoint:function(e){if(null==jsYandexCE.arData.PLACEMARKS)jsYandexCE.arData.PLACEMARKS=[];var t=jsYandexCE.arData.PLACEMARKS.length;jsYandexCE.arData.PLACEMARKS[t]=new CBXYandexPoint({TEXT:e.TEXT,LON:e.LON,LAT:e.LAT});jsYandexCE.arData.PLACEMARKS[t].onDelete=function(){jsYandexCE.arData.PLACEMARKS[t].DELETED=1};return t},addCustomPoly:function(e){if(null==jsYandexCE.arData.POLYLINES)jsYandexCE.arData.POLYLINES=[];var t=jsYandexCE.arData.POLYLINES.length;jsYandexCE.arData.POLYLINES[t]=new CBXYandexPoly(e);jsYandexCE.arData.POLYLINES[t].onDelete=function(){jsYandexCE.arData.POLYLINES[t].DELETED=1};return t},__addPoint:function(e){if(!jsYandexCE.bAddPointMode)return;var t=e.get("coordPosition");var a=jsYandexCE.addCustomPoint({TEXT:"",LAT:t[0],LON:t[1]});jsYandexCE.arData.PLACEMARKS[a].Edit()},__startPoly:function(e){if(!jsYandexCE.bAddPolyMode)return;if(null==jsYandexCE.arData.POLYLINES)jsYandexCE.arData.POLYLINES=[];jsYandexCE.map.events.remove("dblclick",jsYandexCE.__addPoint);BX("bx_yandex_addpoly_message").style.display="none";BX("bx_yandex_addpoly_message1").style.display="block";var t=jsYandexCE.arData.POLYLINES.length;jsYandexCE.arData.POLYLINES[t]=new CBXYandexPoly;jsYandexCE.arData.POLYLINES[t].Start(e.get("coordPosition"));jsYandexCE.arData.POLYLINES[t].onFinish=function(){BX("bx_yandex_addpoly_message").style.display="block";BX("bx_yandex_addpoly_message1").style.display="none";jsYandexCE.map.events.add("dblclick",jsYandexCE.__startPoly)};jsYandexCE.arData.POLYLINES[t].onDelete=function(){jsYandexCE.arData.POLYLINES[t].DELETED=1}},__checkValidKey:function(e){if(Number(e)==e)return true;for(var t=0,a=jsYandexCE.__arValidKeys.length;t<a;t++){if(jsYandexCE.__arValidKeys[t]==e)return true}return false},__serialize:function(e){if(typeof e=="object"){var t="",a=0;for(var n in e){if(jsYandexCE.__checkValidKey(n)){++a;t+=jsYandexCE.__serialize(n)+jsYandexCE.__serialize(e[n])}}t="a:"+a+":{"+t+"}";return t}else if(typeof e=="boolean"){return"b:"+(e?1:0)+";"}else if(null==e){return"N;"}else if(Number(e)==e&&e!=""&&e!=" "){if(Math.floor(e)==e)return"i:"+e+";";else return"d:"+e+";"}else if(typeof e=="string"){e=e.replace(/\r\n/g,"\n");e=e.replace(/\n/g,"###RN###");var s=0;if(window._global_BX_UTF){for(var i=0,a=e.length;i<a;i++){if(e.charCodeAt(i)>2047)s+=2;else if(e.charCodeAt(i)>127)s++}}return"s:"+(e.length+s)+':"'+e+'";'}},__saveChanges:function(){if(!jsYandexCE.map)return false;jsYandexCE.bAddPointMode=false;var e={yandex_lat:jsYandexCE.arData.yandex_lat,yandex_lon:jsYandexCE.arData.yandex_lon,yandex_scale:jsYandexCE.arData.yandex_scale};if(jsYandexCE.arData["PLACEMARKS"]){e.PLACEMARKS=[];for(var t=0,a=jsYandexCE.arData.PLACEMARKS.length;t<a;t++){if(null==jsYandexCE.arData.PLACEMARKS[t].DELETED)e.PLACEMARKS[e.PLACEMARKS.length]=jsYandexCE.arData.PLACEMARKS[t].getData()}}if(jsYandexCE.arData["POLYLINES"]){e.POLYLINES=[];for(var t=0,a=jsYandexCE.arData.POLYLINES.length;t<a;t++){if(null==jsYandexCE.arData.POLYLINES[t].DELETED&&null!=jsYandexCE.arData.POLYLINES[t].POLYLINE)e.POLYLINES[e.POLYLINES.length]=jsYandexCE.arData.POLYLINES[t].getData()}}window.jsYandexCEOpener.saveData(jsYandexCE.__serialize(e),jsYandexCE.currentView);return false},clear:function(){jsYandexCE.bInitCompleted=false;jsYandexCE.bInitScriptsLoaded=false;jsYandexCE.bAddPointMode=false;jsYandexCE.bAddPolyMode=false;if(null!=jsYandexCE.arData.PLACEMARKS&&jsYandexCE.arData.PLACEMARKS.length>0){for(var e=0,t=jsYandexCE.arData.PLACEMARKS.length;e<t;e++){jsYandexCE.arData.PLACEMARKS[e].Delete();jsYandexCE.arData.PLACEMARKS[e]=null}jsYandexCE.arData.PLACEMARKS=[]}if(null!=jsYandexCE.arData.POLYLINES&&jsYandexCE.arData.POLYLINES.length>0){for(var e=0,t=jsYandexCE.arData.POLYLINES.length;e<t;e++){jsYandexCE.arData.POLYLINES[e].Delete();jsYandexCE.arData.POLYLINES[e]=null}jsYandexCE.arData.POLYLINES=[]}jsYandexCE.map=null}};var jsYandexCESearch={bInited:false,map:null,obInput:null,timerID:null,timerDelay:1e3,arSearchResults:[],obOut:null,__init:function(e){if(jsYandexCESearch.bInited)return;jsYandexCESearch.map=jsYandexCE.map;jsYandexCESearch.obInput=e;e.form.onsubmit=function(){jsYandexCESearch.doSearch();return false};e.onfocus=jsYandexCESearch.showResults;e.onblur=jsYandexCESearch.hideResults;jsYandexCESearch.bInited=true},setTypingStarted:function(e){if(!jsYandexCESearch.bInited)jsYandexCESearch.__init(e);jsYandexCESearch.hideResults();if(null!=jsYandexCESearch.timerID)clearTimeout(jsYandexCESearch.timerID);jsYandexCESearch.timerID=setTimeout(jsYandexCESearch.doSearch,jsYandexCESearch.timerDelay)},doSearch:function(){var e=BX.util.trim(jsYandexCESearch.obInput.value);if(e.length>1){ymaps.geocode(e).then(jsYandexCESearch.__searchResultsLoad,jsYandexCESearch.handleError)}},handleError:function(e){alert(this.jsMess.mess_error+": "+e.message)},__generateOutput:function(){jsYandexCESearch.obOut=document.body.appendChild(document.createElement("UL"));jsYandexCESearch.obOut.className="bx-yandex-address-search-results";jsYandexCESearch.obOut.style.display="none"},__searchResultsLoad:function(e){if(null==jsYandexCESearch.obOut)jsYandexCESearch.__generateOutput();jsYandexCESearch.obOut.innerHTML="";jsYandexCESearch.clearSearchResults();var t=e.geoObjects.getLength();if(t>0){for(var a=0;a<t;a++){jsYandexCESearch.arSearchResults[a]=e.geoObjects.get(a);var n=document.createElement("LI");if(a==0)n.className="bx-yandex-first";var s=document.createElement("A");s.href="javascript:void(0)";var i=s.appendChild(document.createElement("SPAN"));i.appendChild(document.createTextNode(jsYandexCESearch.arSearchResults[a].properties.get("metaDataProperty").GeocoderMetaData.text));s.BXSearchIndex=a;s.onclick=jsYandexCESearch.__showSearchResult;n.appendChild(s);jsYandexCESearch.obOut.appendChild(n)}}else{jsYandexCESearch.obOut.innerHTML='<li class="bx-yandex-notfound">'+window.jsYandexMess.nothing_found+"</li>"}jsYandexCESearch.showResults()},__showSearchResult:function(e){if(null!==this.BXSearchIndex){jsYandexCESearch.map.panTo(jsYandexCESearch.arSearchResults[this.BXSearchIndex].geometry.getCoordinates())}return BX.PreventDefault(e)},showResults:function(){var e=BX.pos(jsYandexCESearch.obInput);jsYandexCESearch.obOut.style.top=e.bottom+2+"px";jsYandexCESearch.obOut.style.left=e.left+"px";jsYandexCESearch.obOut.style.zIndex=parseInt(BX.WindowManager.Get().zIndex)+200;if(BX.findParent(jsYandexCESearch.obInput,{tag:"div",className:"bx-core-window bx-core-adm-dialog"}).style.display=="block"){if(null!=jsYandexCESearch.obOut)jsYandexCESearch.obOut.style.display="block"}},hideResults:function(){if(null!=jsYandexCESearch.obOut){setTimeout("jsYandexCESearch.obOut.style.display = 'none'",300)}},clearSearchResults:function(){for(var e=0;e<jsYandexCESearch.arSearchResults.length;e++){delete jsYandexCESearch.arSearchResults[e]}jsYandexCESearch.arSearchResults=[]},clear:function(){if(!jsYandexCESearch.bInited)return;jsYandexCESearch.bInited=false;if(null!=jsYandexCESearch.obOut){jsYandexCESearch.obOut.parentNode.removeChild(jsYandexCESearch.obOut);jsYandexCESearch.obOut=null}jsYandexCESearch.arSearchResults=[];jsYandexCESearch.map=null;jsYandexCESearch.obInput=null;jsYandexCESearch.timerID=null}};
//# sourceMappingURL=settings_load.map.js